/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * All Rights Researved.
 *
 * This library is developed and distributed for free usage,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * You can redistribute and/or modify it under the terms of the
 * Simplified BSD License
 *
 *
 *
 *
 *
 *
 *
 *
 * @Original Author: jin Chen
 * @date: Apr 15, 2004$
 * @version: 1.0
 */
package edu.psu.geovista.app.dataloader.v1.gui;

import edu.psu.geovista.app.dataloader.v1.DataLoaders;
import edu.psu.geovista.app.dataloader.v1.components.PcpDataLoader;

import javax.swing.*;

public class BasicPane extends JPanel{

    protected DataLoaders dataloader;
    protected PcpDataLoader pcpload;
    protected edu.psu.geovista.app.dataloader.v1.components.TsDataLoader tsload;


    protected JPanel controlP;
    protected JButton midBtn=new JButton();
    protected JButton rightBtn=new JButton();
    protected JButton leftBtn=new JButton();

    public BasicPane(DataLoaders dataloader) {
       this.dataloader = dataloader;
        pcpload=dataloader.getPcpload();
        tsload=dataloader.getTsload();
    }
    /**
     *
     * @param bttn
     * @param a
     * @param text    button text
     */
    public void setButtonAction(int bttn,Action a,String text) {
        if(bttn== DataLoaders.Btn_R){
             this.rightBtn.setAction(a);
             rightBtn.setText(text);
        }
        else if(bttn==DataLoaders.Btn_M){
             midBtn.setAction(a);
             midBtn.setText(text);
        }
        else if(bttn==DataLoaders.Btn_L){
              this.leftBtn.setAction(a);
            this.leftBtn.setText(text);
        }
    }

     protected JPanel getControlPane(){
       if(this.controlP ==null){
            JPanel p=new JPanel();
           p.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
           this.setControlPane(p);
           controlP=p;

       }
       return controlP;
    }
    protected void setControlPane(JPanel p){
        p.add(leftBtn);
        p.add(midBtn);
        p.add(rightBtn);

    }
}
